﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;
using QuantitativeInvestment.Tools;

namespace QuantitativeInvestment.Factor
{
    class RsiFactor:Factor
    {
        public RsiFactor()
        {
            this.name = "相对强弱";
            Parameter p = new Parameter("天数", 30);
            this.paraList.Add(p.name, p);
        }
        public override void addFactorValue(Stock stock)
        {
            int num=Int32.Parse(this.paraList["天数"].value.ToString());
            if (!stock.factors.ContainsKey(this.name + this.paraList["天数"].value.ToString()))
            {
                TaLib lib = new TaLib();
                double[] rsiValues = lib.getRsi(stock.factors["价格"], num); ; 
                stock.factors.Add(this.name+this.paraList["天数"].value.ToString(),rsiValues );
            }
        }
    }
}
